﻿/*
 * Copyright (C) 冷锋
 */
#ifndef SVRIO_H
#define SVRIO_H

#include "defines.h"

class CSvrIO
{
public:
	CSvrIO( const char*sIP,const short iPort );
	int Open();
protected:
	virtual int ProcessEvent()=0;
	virtual int  OnConnect( int fd,sockaddr* ){}
	virtual int  OnClose( Connection*pConn ){}
	virtual int  OnRead( Connection*pConn ){}
	virtual int  OnWrite( Connection*pConn ){}
	virtual void PrepareListenfd(){}

	void AddConn( Connection*pConn,unsigned char flag ){};
	int  Read( Connection*pConn,int len );
protected:
	char  m_svrIP[16];
	short m_svrPort;
	int	  m_iListenFd;
};




#endif
